<#assign base=request.contextPath>
<!DOCTYPE html> 
<html>
	<head>
		<title></title>
		<meta charset="utf-8">
		<#include "common/reference.ftl" />
		<#include "common/ligerui.ftl" />
		<script type="text/javascript">
		<!--
			var ligerTable = null;
			$(function(){
				$('.select-chosen').chosen();
				ligerTable = $('#table').ligerGrid({
					width:'98%',
					enabledSort:false,
					pageSizeOptions:[5,10,20,50,100,200],
					height:'auto',
					alternatingRow:true,
					url:'${base}/${route}/getList',
					delayLoad:false,
					columns:[
						{display:'ID',name:'discountId',id:'discountId',align:'center'},
						{display:'充值金额(¥)',name:'rechargeMoney',id:'rechargeMoney',align:'center'},
						{display:'赠送金额(¥)',name:'giveMoney',id:'giveMoney',align:'center'},
						{display:'备注说明',name:'remark',id:'remark',align:'center'},
						{
							display:'是否启用',
							name:'enabled',
							id:'enabled',
							align:'center',
							render:function(row){
								if(row.enabled){
									return '是';
								}
								return '否';
							}
						}
					],
					onDblClickRow: function (data, rowindex, rowobj){
						layer.open({
							title:'${module}',
							type:2,
							maxmin:false,
							area: ['100%', '100%'],
							content:'${base}/${route}/view/'+data.discountId
						});
					}
				});
				$('#btnEdit').click(function(){
					if(ligerTable){
			    		var row = ligerTable.getSelectedRow();
			    		if(!row || row.discountId < 1){
							layer.msg('请选择行')
			    			return;
			    		}
			    		var discountId = row.discountId;
			        	var url='${base}/${route}/edit/'+discountId;
			            changePage(url);
			    	}
				});
				$('#btnRemove').click(function(){
					if(ligerTable){
			    		var row = ligerTable.getSelectedRow();
			    		if(!row || row.discountId < 1){
							layer.msg('请选择行')
			    			return;
			    		}
			    		var discountId = row.discountId;
			    		layer.confirm('确定要删除吗？',function(){
			    			$.ajax({
			            		url:'${base}/${route}/remove/'+discountId,
			            		type:'POST',
			            		data:{},
			            		dataType:'json',
			            		success:function(rst){
			            			layer.alert(rst.message);
			            			if(rst.status=='OK' && ligerTable != null ){
			            				ligerTable.reload();
			            			}
			            		}
			            	});	
			    		});
			    	}
				});
			});
		//-->
		</script>
	</head>
	<body class="$configs["skinName"]">
		<#include "common/breadcrumb.ftl">
		<div class="widget-box">
			<div class="widget-header">
				<h5 class="lighter">
					<i class="icon-table"></i>
					${module}列表
				</h5>
				<!--非查询者有该操作-->
				<#if user?exists && viewerRole?exists && user.roleId != viewerRole>
				<div class="widget-toolbar">
					<button id="btnEdit" type="button" class="btn btn-primary btn-xs">
						<i class="fa fa-check-square-o"></i>编辑
					</button>
					<button id="btnRemove" type="button" class="btn btn-primary btn-xs">
						<i class="fa fa-trash-o"></i>删除
					</button>
				</div>
				</#if>
			</div>
			<div class="widget-body">
				<div id="table"><div>
			</div>
		</div>
	</body>
</html>